package cn.bdqn.repository;

import cn.bdqn.pojo.Attributes;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface Asecu_AttrManagementRepository extends JpaRepository<Attributes,Integer> {

    List<Attributes> findByAttrId(@Param("attrId") int attrId);

    @Modifying
    @Query("UPDATE Attributes SET attrId = :settingId WHERE id = :id")
    int update(@Param("settingId") Integer settingId, @Param("id") Integer id);

    @Modifying
    @Query("UPDATE Attributes SET NAME = :name WHERE id = :id")
    int edit(@Param("name") String name,@Param("id") Integer id);

    @Modifying
    @Query("UPDATE Attributes SET attrId = 0 WHERE id = :sid")
    int updateAttrId(@Param("sid") Integer sid);
}
